Precise, Efficient, and Transparent Transfer of Execution Between an Auto-generated In-line Accelerator and Processor(s)

ABSTRACT

A data processing system is disclosed that includes an in-line accelerator and a processor. The system can be extended to include an in-line accelerator and system of multi-level accelerators and a processor. The in-line accelerator receives the incoming data elements and begins processing. Upon premature termination of the execution, the in-line accelerator transfers the execution to a processor (or the next level accelerator in a multi-level acceleration system). Transfer of execution includes transferring of data and control. The processor (or the next accelerator) either continues the execution of the in-line accelerator from the bailout point or restarts the execution. The necessary data must be transferred to the processor (or the next accelerator) to complete the execution.

RELATED APPLICATIONS

This application claims the benefit of U.S. Provisional Application No. 62/194,885, filed on Jul. 21, 2015, the entire contents of which are hereby incorporated by reference.

TECHNICAL FIELD

Embodiments described herein generally relate to the field of data processing, and more particularly relates to methods and system of automated data transfer between an in-line accelerator and processors.

BACKGROUND

Conventionally, system processing functionalities are written in software for execution in some type of processor to accommodate for future modifications and updates. However, a system functionality executed in software by processor(s) is typically slower than if that same functionality was implemented and executed using accelerators, either as special purpose processors or application specific hardware dedicated to the particular function. Accelerators can increase the performance, decrease the processing latency, and decrease the power consumption of computer systems.

Since accelerators are customized to process only a particular portion of an application, they are often paired with processor(s) in a system to be able to execute the entire application. The part of the application that is compatible with the accelerator is executed by the accelerator. The remaining part is executed by the processor. Traditionally, the accelerator is a slave component for a processor that functions as a master component. The applications run on the processor and for the part of the application that is amenable to acceleration, the processor transfers the control to the accelerator. After finishing the accelerated part of the application, the accelerator returns back the control to the processor.

The conventional acceleration method described above entails a high overhead. First, the input data elements from an input interface must be copied to the processor and then they should be stored in the accelerator. Next, the output data elements (if any) from the accelerator must be copied to the processor and then they should be stored in an output interface. There therefore remains a need for a method and system of implementing an accelerator in conjunction with a processor that overcomes these challenges.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates the schematic diagram of a data processing system according to an embodiment of the present invention.

FIG. 2 illustrates the schematic diagram of a multi-layer in-line accelerator according to an embodiment of the invention.

FIG. 3A is a flow diagram illustrating a method flowchart for system performance during compilation time according to an embodiment of the invention.

FIG. 3B is a flow diagram illustrating a method flowchart for system performance during runtime according to an embodiment of the invention.

FIG. 4 illustrates the schematic diagram of a dataflow node according to an embodiment of the invention.

FIG. 5 illustrates the schematic diagram of composition of multiple nodes using lock-based synchronization mechanism to access a shared memory according to an embodiment of the invention.

FIG. 6 illustrates the schematic diagram of execution of an application by data processing system according to an embodiment of the invention.

FIG. 7 illustrates the schematic diagram of execution of an application sliced into hot/cold operations by the data processing system according to an embodiment of the invention.

FIG. 8 illustrates the schematic diagram of a state machine simulation mechanism in accordance with an embodiment of the invention.

FIG. 9A illustrates the schematic diagram of memory block architecture in accordance with an embodiment of the invention.

FIG. 9B illustrates the schematic diagram of memory block architecture including a quasi-speculative memory in accordance with an embodiment of the invention.

FIG. 10 illustrates the schematic diagram of implementing a bailout table in accordance with an embodiment of the invention.

FIG. 11 is a flow diagram illustrating a method flowchart for transferring execution according to an embodiment of the invention.

FIG. 12 is a diagram of a computer system including a data processing system according to an embodiment of the invention.

DESCRIPTION OF EMBODIMENTS

Methods, systems and apparatuses for precise, efficient, and transparent transfer of control and data states between an in-line accelerator and a processor are described. An embodiment of invention includes a processor and an in-line accelerator. The input data elements are received by the in-line accelerator. In an embodiment, a compiler may slice the computation associated with processing a data into a fast-path, compiled and/or synthesized into an in-line accelerator, and a slow-path, processed by the processor. In an embodiment, upon premature termination of processing in the fast-path, the execution is automatically transferred to the processor. The transitioning of the computation associated with an input from the in-line accelerator to the processor is referred to as a bailout.

In an embodiment, upon a bailout, the processor (or another acceleration layer in the case of multi-layer in-line acceleration) begins processing the input data elements as if no processing is done by the in-line accelerator. In such an embodiment, the execution of traces on the in-line accelerator is performed speculatively before the bailout. Therefore, the side effects of the computation must be rolled back. In another embodiment, the processor (or the accelerator in the next level in the case of multi-layer in-line acceleration) continues the processing of the in-line accelerator from the bailout point. In such an embodiment, the side effects of the computation by the in-line accelerator are accessible by the processor (or the accelerator in the next level in the multi-level in-line acceleration scenario).

In the following description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the present invention. It will be apparent, however, to one skilled in the art that the present invention can be practiced without these specific details. In other instances, well-known structures and devices are shown in block diagram form in order to avoid obscuring the present invention.

Reference in the specification to “one embodiment” or “an embodiment” means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present invention. Thus, the appearances of the phrase “in one embodiment” appearing in various places throughout the specification are not necessarily all referring to the same embodiment. Likewise, the appearances of the phrase “in another embodiment,” or “in an alternate embodiment” appearing in various places throughout the specification are not all necessarily all referring to the same embodiment.

The following glossary of terminology and acronyms serves to assist the reader by providing a simplified quick-reference definition. A person of ordinary skill in the art may understand the terms as used herein according to general usage and definitions that appear in widely available standards and reference books.

-   -   HW: Hardware.     -   SW: Software.     -   I/O: Input/Output.     -   DMA: Direct Memory Access.     -   CPU: central processing unit.     -   FPGA: Field Programmable Gate Arrays.     -   CGRA: Coarse-Grain Reconfigurable Accelerators.     -   GPGPU: General-Purpose Graphical Processing Units.     -   MLWC: Many light-weight cores.     -   ASIC: Application Specific Integrated Circuit.     -   PCIe: Peripheral Component Interconnect express.     -   CDFG: Control and Data-Flow Graph.     -   Dataflow analysis: An analysis performed by a compiler on the         CDFG of the program to determine dependencies between a write         operation on a variable and the consequent operations which         might be dependent on the written operation.     -   Accelerator: a specialized HW/SW component that is customized to         run an application or a class of applications efficiently.     -   In-line accelerator: An accelerator for IO-intensive         applications that can send and receive data without CPU         involvement. If an in-line accelerator cannot finish the         processing of an input data, it passes the data to the CPU for         further processing.     -   Bailout: The process of transitioning the computation associated         with an input from an in-line accelerator to a processor (i.e.         general purpose core).     -   Continuation: A kind of bailout that causes the CPU to continue         the execution of an input data on an accelerator right after the         bailout point.     -   Rollback: A kind of bailout that causes the CPU to restart the         execution of an input data on an accelerator from the beginning.     -   Gorilla++: A programming model and language with both dataflow         and shared-memory constructs as well as a toolset that generates         HW/SW from a Gorilla++ description.     -   GDF: Gorilla dataflow (the execution model of Gorilla++).     -   GDF node: A building block of a GDF design that receives an         input, may apply a computation kernel on the input, and         generates corresponding outputs. A GDF design consists of         multiple GDF nodes. A GDF node may be realized as a hardware         module or a software thread or a hybrid component. Multiple         nodes may be realized on the same virtualized hardware module or         on a same virtualized software thread.     -   Engine: A special kind of component such as GDF that contains         computation.     -   Infrastructure component: Memory, synchronization, and         communication components.     -   Computation kernel: The computation that is applied to all input         data elements in an engine.     -   Data state: A set of memory elements that contains the current         state of computation in a Gorilla program.     -   Control State: A pointer to the current state in a state         machine, stage in a pipeline, or instruction in a program         associated to an engine.     -   Dataflow token: Components input/output data elements.     -   Kernel operation: An atomic unit of computation in a kernel.         There might not be a one to one mapping between kernel         operations and the corresponding realizations as states in a         state machine, stages in a pipeline, or instructions running on         a processor.

FIG. 1 illustrates the schematic diagram of data processing system 100 according to an embodiment of the present invention. Data processing system 100 includes I/O processing unit 110 and processor 120. In an embodiment, processor 120 may include a general purpose core or multiple general purpose cores. A general purpose core is not tied to or integrated with any particular algorithm. In an alternative embodiment, processor 120 may be a specialized core. I/O processing unit 110 may include in-line accelerator 111. In-line accelerators are a special class of accelerators that may be used for I/O intensive applications. In-line accelerator 111 and processor may or may not be on a same chip. In-line accelerator 111 is coupled to I/O interface 112. Considering the type of input interface or input data, in one embodiment, the in-line accelerator 111 may receive any type of network packets from an input network interface card (NIC). In another embodiment, the accelerator maybe receiving raw images or videos from the input cameras. In an embodiment, in-line accelerator 111 may also receive voice data from an input voice sensor device.

In an embodiment, in-line accelerator 111 is coupled to multiple I/O interfaces (not shown in the figure). In an embodiment, input data elements are received by I/O interface 112 and the corresponding output data elements generated as the result of the system computation are sent out by I/O interface 112. In an embodiment, I/O data elements are directly passed to/from in-line accelerator 111. In processing the input data elements, in an embodiment, in-line accelerator 111 may be required to transfer the control to processor 120. In an alternative embodiment, in-line accelerator 111 completes execution without transferring the control to processor 120. In an embodiment, in-line accelerator 111 has a master role and processor 120 has a slave role.

In an embodiment, in-line accelerator 111 partially performs the computation associated with the input data elements and transfers the control to other accelerators or the main processor in the system to complete the processing. The term “computation” as used herein may refer to any computer task processing including, but not limited to, any of arithmetic/logic operations, memory operations, I/O operations, and offloading part of the computation to other elements of the system such as processors and accelerators. In-line accelerator 111 may transfer the control to processor 120 to complete the computation. In an alternative embodiment, in-line accelerator 111 performs the computation completely and passes the output data elements to I/O interface 112. In another embodiment, in-line accelerator 111 does not perform any computation on the input data elements and only passes the data to processor 120 for computation. In another embodiment, processor 120 may have in-line accelerator 111 to take control and completes the computation before sending the output data elements to the I/O interface 112.

In an embodiment, in-line accelerator 111 may be implemented using any device known to be used as accelerator, including but not limited to field-programmable gate array (FPGA), Coarse-Grained Reconfigurable Architecture (CGRA), general-purpose computing on graphics processing unit (GPGPU), many light-weight cores (MLWC), network processor, I/O processor, and application-specific integrated circuit (ASIC). In an embodiment, I/O interface 112 may provide connectivity to other interfaces that may be used in networks, storages, cameras, or other user interface devices. I/O interface 112 may include receive first in first out (FIFO) storage 113 and transmit FIFO storage 114. FIFO storages 113 and 114 may be implemented using SRAM, flip-flops, latches or any other suitable form of storage. The input packets are fed to the in-line accelerator through receive FIFO storage 113 and the generated packets are sent over the network by the in-line accelerator and/or processor through transmit FIFO storage 114.

In an embodiment, I/O processing unit 110 may be Network Interface Card (NIC). In an embodiment of the invention, in-line accelerator 111 is part of the NIC. In an embodiment, the NIC is on the same chip as processor 120. In an alternative embodiment, the NIC 110 is on a separate chip coupled to processor 120. In an embodiment, the NIC-based in-line accelerator receives an incoming packet, as input data elements through I/O interface 112, processes the packet and generates the response packet(s) without involving processor 120. Only when in-line accelerator 112 cannot handle the input packet by itself, the packet is transferred to processor 120. In an embodiment, in-line accelerator 112 communicates with other I/O interfaces, for example, storage elements through direct memory access (DMA) to retrieve data without involving processor 120.

In-line accelerator 111 and the processor 120 are coupled to shared memory 143 through private cache memories 141 and 142 respectively. In an embodiment, shared memory 143 is a coherent memory system. The coherent memory system may be implemented as shared cache. In an embodiment, the coherent memory system is implemented using multiples caches with coherency protocol in front of a higher capacity memory such as a DRAM.

Processing data by forming two paths of computations on in-line accelerators and processors (or multiple paths of computation when there are multiple acceleration layers) have many other applications apart from low-level network applications. For example, most emerging big-data applications in data centers have been moving toward scale-out architectures, a technology for scaling the processing power, memory capacity and bandwidth, as well as persistent storage capacity and bandwidth. These scale-out architectures are highly network-intensive. Therefore, they can benefit from in-line acceleration. These applications, however, have a dynamic nature requiring frequent changes and modifications. Therefore, it is highly beneficial to automate the process of splitting an application into a fast-path that can be executed by an in-line accelerator and a slow-path that can be executed by a processor as disclosed herein.

While embodiments of the invention are shown as two accelerated and general-purpose layers throughout this document, it is appreciated by one skilled in the art that the invention can be implemented to include multiple layers of in-line computation with different levels of acceleration and generality. For example, an in-line FPGA accelerator can backed by an in-line many-core hardware. In an embodiment, the in-line many-core hardware can be backed by a processor.

Referring to FIG. 2, in an embodiment of invention, a multi-layer system 200 is formed by a first in-line accelerator 211 ₁ and several other in-line accelerators 211 ₂₋₁₁. The multi-layer system 200 includes several accelerators, each performing a particular level of acceleration. In such a system, execution may begin at a first layer by the first in-line accelerator 211 ₁. Then, each subsequent layer of acceleration is invoked when the execution exits the layer before it. For example, if the in-line accelerator 211 ₁ cannot finish the processing of the input data, the input data and the execution will be transferred to the next acceleration layer, in-line accelerator 211 ₂. In an embodiment, the transfer of data between different layers of accelerations may be done through dedicated channels between layers (311 ₁ to 311 _(n)). In an embodiment, when the execution exits the last acceleration layer by in-line accelerator 211 _(n), the control will be transferred to the general-purpose core 220.

FIG. 3A is flow diagram illustrating a method flowchart for automatic generation of an in-line accelerator by synthesis to hardware model and/or compilation to software for a particular input program during the compilation. FIG. 3B is flow diagram illustrating a method flowchart for implementing the in-line accelerator in the runtime. Although the blocks in the flowcharts with reference to FIGS. 3A and 3B are shown in a particular order, the order of the actions can be modified. Thus, the illustrated embodiments can be performed in a different order, and some actions/blocks may be performed in parallel. Some of the blocks and/or operations listed in FIGS. 3A and 3B are optional in accordance with certain embodiments. The numbering of the blocks presented is for the sake of clarity and is not intended to prescribe an order of operations in which the various blocks must occur. Additionally, operations from the various flows may be utilized in a variety of combinations.

In the first step of compilation, at stage 311 of FIG. 3A, the input program is profiled. Profiling is done by feeding a representative input data to the program, e.g. a set of input requests to a server or a set of input images to an image processing application. In an embodiment, the profiling is performed to identify the fast-path, the trace of highly-executed kernel operations (e.g., basic blocks of the program control and data flow graph (CDFG)). Since the fast-path executes highly used kernel operations, it would be beneficial to implement them by an in-line accelerator. In an embodiment, the profiling may be done based on the data access cost as explained in more details below.

Referring to FIG. 3A, at stage 312 the program is sliced into a fast path and a slow path based on the result of the profiling step 311. In an embodiment, input data elements are received by the server for processing. The program on the server reads the input data element and apply the computation kernel on them. Each computation kernel may have a CDFG which is graph describing the flow of control and flow of the data in the program. At stage 312, the CDFG is sliced to extract subgraphs that are most frequently used. In case of multi-layer system, the CDFG may be sliced to different levels of frequency. Fully connected subgraphs are referred to as a trace. In an embodiment, the traces of highly-executed basic blocks are extracted to form the hot traces. The remaining traces are cold traces.

In an embodiment, a fast path may be formed to execute hot traces by an in-line accelerator. In an embodiment, when an input data enters the in-line accelerator, in-line accelerator can process data as long as the execution trace remains in the fast path trace. If the execution trace exits the fast-path, the accelerator cannot process the input data anymore. As such, at stage 313, a bailout code is automatically generated upon the termination of hot trace to transfer execution from the in-line accelerator to a general-purpose core (slow path). In an embodiment, bailout code facilitates transitioning between the fast path implemented by an in-line accelerator to the slow path implemented by a processor.

In a multi-layer acceleration, there may be multiple fast path traces each for various execution frequencies observed during profiling. In an embodiment, the first in-line accelerator will run the trace of operations with maximum execution frequency. Upon bailout the execution may be transferred to the next in-line accelerator, which runs the trace of operations with a lower execution frequency and so on. Eventually the processor runs the non-accelerated application.

In an embodiment of the invention, a hardwired in-line accelerator can be generated for the extracted fast-path by running the fast-path part of the application plus bailout mechanism through an HLS (High-Level Synthesis) tool. In an embodiment, the hardwired accelerator is implemented on an FPGA or an ASIC substrate. A programmable in-line accelerator, e.g. a network processor or a CGRA, can be programmed by compiling the fast-path plus bailout mechanism into the corresponding micro-codes or instructions. This automation makes the acceleration process transparent and amenable to any arbitrary application. Similar mechanisms can be used to generate accelerators for different acceleration level in a multi-layer in-line acceleration system.

FIG. 3B is flow diagram illustrating a method flowchart for implementing the in-line accelerator in the runtime. During the runtime, at stage 321, the in-line accelerator receives the input data elements. In an embodiment, the incoming packets as input data elements are directly communicated to an in-line accelerator through an I/O interface. At stage 322, the in-line accelerator starts processing the input data elements. In an embodiment, the input data elements may be entirely processed by the in-line accelerator. In other embodiment, the execution of hot traces may finish prematurely on the in-line accelerator (bailout). Upon occurrence of a bailout, the bailout code is executed to transfer control and data operation between the in-line accelerator and the processor (or the accelerator in the next level in the case of multi-layer in-line acceleration scenario). The implementation of bailouts is discussed in further details below.

In an embodiment, no bailout occurs in executing the input data elements and the execution remains entirely in the fast path. In an alternative embodiment, the in-line accelerator fails to complete computation on input data elements. As such, the in-line accelerator will send the data state to a processor (or the accelerator in the next level in a multi-level in-line acceleration scenario). A data state is a set of memory elements that contains the current operation of computation. Subsequently, at stage 323 the processor executes operations associated with processing the input data elements.

Referring to FIG. 3B, if the application requires generating a response, a response is generated by the processor at stage 324. In an embodiment, the in-line accelerator generates response packets without involving the processor. In an embodiment, the execution is first transferred from the in-line accelerator to the processor and the response packets are generated by the processor.

Any data parallel execution model including high-level dataflow execution models such as MapReduce, Dryad, and Spark may be used to design the data processing system in accordance with the disclosed invention. Embodiments of the invention can also be extended to sequential languages such as C/C++ either by considering the sequential code as a single (probably big) dataflow node or by converting the sequential program to the parallel programming language to achieve better performance. For purposes of providing an example only and without limiting the structure, function, purposes and use of embodiment of the invention, an exemplary implementation of the invention is explained in the context of Gorilla++ programming model.

Gorilla++ is an example of parallel programming language and a toolset for designing high performance streaming accelerators including networking and big-data applications. Gorilla Dataflow (GDF) is the execution model that Gorilla++ is built upon. GDF plays an essential role in the Gorilla++ toolset. GDF is designed based on three major goals: (i) generality to cover a wide range of applications, (ii) expressiveness to facilitate the modeling of the target applications, and (iii) analyzability to improve the quality of the results of Gorilla++ compiler. An important feature of GDF model that improves both programmability and analyzability of the model is using structured composition of the connectivity and interfaces of the nodes.

Referring to FIG. 4, dataflow node 400, e.g. Gorilla Dataflow (GDF) node, is shown according to an embodiment of the invention. Dataflow node 400 uses a rendezvous mechanism for communication between dataflow nodes. Its rendezvous mechanism may be implemented using FIFO interfaces, adopted from the theory of latency-insensitive designs. In addition to push-only, one-way interfaces, dataflow node 400 has two-way request/reply interfaces, also known as offload interfaces.

Referring to FIG. 4, dataflow node 400 includes input 401, output 403, and offload interface 402. In an embodiment, the offload interface includes n offload interface nodes (402 ₁, 402 ₂ . . . and 402 _(n)). Furthermore, each node with offload interface may be split into multiple nodes and each offload interface can be modeled as two one-way interfaces. Therefore, in an embodiment of invention, dataflow node 400 is transformed into a dataflow graph without requiring any two-way offload interface. In an embodiment, dataflow node 400 uses offload interfaces as first-order construct in order to improve the expressiveness and analyzability of the model.

Referring back to FIG. 4, a dataflow node 400 may have one input 401, one output 403, and several offload interfaces nodes 402 (402 ₁, 402 ₂ . . . and 402 _(n)). In an alternative embodiment, a dataflow node may have zero offload interface node. In an embodiment, dataflow node may have multiple input/output interfaces, for example, for the purpose of merging or distributing data elements. In such an embodiment, the nodes may only be able to reorder the data elements and may not be able to change the data elements themselves. These nodes may be transparent to the programmers and may be used in composition of nodes. In an embodiment, connecting the nodes together is done using a predefined set of composition functions.

FIG. 5 illustrates the schematic diagram of composition of multiple nodes using lock-based synchronization mechanism to access a shared memory. In standard dataflow centric models of computation, e.g., KPN model, every dataflow node is supposed to receive self-contained token(s) that carry the data for processing. The nodes do not need any global states to process the incoming tokens. Gorilla++ target applications, however, need to access global states, e.g., shared data structures. Gorilla++ uses a lock-based synchronization mechanism to solve this problem. Gorilla++ uses shared memories to save the global data.

Referring to FIG. 5, engines 511, 512, and 513 are connected through their input/output interface represented by the solid lines to process input 501 and generate output 502. Engines 511, 512, and 513 use offload interfaces to access shared memory 540 represented by the dashed lines. Shared memory 540 may be used to store global data. Since multiple dataflow nodes may access a shared memory, Gorilla++ may require a necessary synchronization mechanism to ensure mutual exclusion while accessing the data. Referring to FIG. 5, lock engine 530 is used for synchronization. Lock engine 530 is accessed by the engines 511, 512, and 513 through offload interfaces represented by the dashed lines. In an embodiment, lock engine 530 does not reply to a lock request from the corresponding engines 511, 512, and 513 unless either (i) the lock is not taken in the first place or (ii) the lock is released and the requester of the lock is the winner among all other lock requesters. Blocks 521 and 522 represent the lock construct interface in Gorilla++.

As and example, in an embodiment, pseudocode below could be used to compose the two types of engines, memory, and lock components to build the design presented in FIG. 3:

-   -   add=Engine(“add.c”); decrement=Engine(“decrement.c”)     -   mem=mem(height=1, width=32); lock=lock(height=1)     -   Design=Offload(Chain(Replicate(add, 2), decrement), mem, lock)

The pseudocode above shows how the computation engines are generated by calling Engine function and passing the corresponding C code as the argument. Similarly, the memory and lock components are generated by calling appropriate functions. Replicate is a composition function that creates multiple instances of its input component to increase its throughput. In this example, a replicated version of the add component is created with a replication factor of two. Chain is used to connect the output of one component to the input of another one and create a larger component. In this example design, the “add” and “decrement” components are chained. Finally, Offload connects one component's offload interface to another component's input/output interface. In this example, “mem” and “lock” components are connected to the “add” and “decrement” components using offload interface.

In an embodiment, a computation consists of multiple phases. In each phase, the dataflow nodes may execute different computation kernels. In GDF, the current phase may be attached to all data elements, which are moved across the system in order to specify the changes in the computation phases.

Referring back to FIG. 5, each of engines 511, 512, and 513 may have four distinct memories: (i) in-token memories, (ii) out-token memories, (iii) context memories, and (iv) shared memories. Incoming data elements are copied into in-token memories and outgoing data elements are copied into out-token memories. Context memories include the data states private to the computation associated to a given input token. When processing a new token, the previous content of these memories does not affect the output results. Shared memories are the data states, which are shared between computations of different input data elements for a single kernel or even computations of different kernels. A kernel needs to be explicitly defined as a client of a shared memory scope or the shared memory is not accessible to the kernel.

Different embodiments may use different implementation of GDF. For example, different implementation of GDP on a system with respect to realization of (i) computation kernels, (ii) dataflow (streaming) channels, (iii) memory components, and (iv) synchronization components may be used. In an embodiment, a part of the GDF can be implemented as hardwired hardware on an FPGA substrate and the rest of GDF can be implemented in software on a CPU. In such an embodiment, when there is a streaming channel between two nodes and one node is on the hardware and the other node is on the software, a special hybrid FIFO with hardware interface on one side and software interface on the other side may be used. In an embodiment where multiple streaming channels are crossing the hardware/software boundaries, hybrid FIFOs can be virtualized over a physical interface, e.g., PCIe interface.

In an embodiment of the invention, the kernels may be realized as hardwired control state machines, synthesized, for example, in any of FPGA, ASIC, or CGRA substrate. In an alternative embodiment, the kernels may be realized as instruction-based computation cores with or without specialized data-path operations. In an embodiment of the invention, the communication channels may be implemented as hardware FIFO channels. In an alternative embodiment, the communication channels are implemented as software FIFOs. In an embodiment, all three types of memories in Gorilla++ may be implemented in a global monolithic memory. In an embodiment, each memory is customized into local registers, local scratch-pads, local coherent memory subsystems, or global coherent memory system. In an embodiment, synchronization components may be implemented in hardware. In another embodiment, the synchronization is implemented using software-based synchronization mechanisms. The software-based synchronization mechanism may be implemented on top of a coherent and consistent memory system.

FIG. 6 illustrates the schematic diagram of processing of an application by data processing system according to an embodiment of the invention. FIG. 6 illustrates another embodiment in which the same reference numerals have been used to denote similar elements, parts and components to those of the embodiment depicted in FIG. 1. A detailed discussion of similar components and similar functionality will therefore not be repeated for the sake of brevity, and only the differences between the first and second embodiments will be described in detail.

At compile time, the program is parsed and translated to generate application control and data flow graph (CDFG) 150. In an embodiment, high-level synthesis reads a high-level description and translates it into a CDFG intermediate form. The CDFG intermediate form should represent all the necessary control and dataflow information. Referring to FIG. 6, operations of the CDFG 150 have been divided into hot operations and cold operations. The hot operations are operations frequently used during the profiling phase of the application. On the other hand, the cold operations are operations that are not frequently used during the profiling phase. In FIG. 6, the hot operations are shaded while the cold operations remain blank. The hot operations of CDFG 150 provide the basis for formation of the system's fast-path. The hot operations of CDFG 150 run on in-line accelerator 111. In an embodiment, in-line accelerator 111 is an FPGA. In an embodiment, in-line accelerator 111 is part of I/O processing unit 110. In an embodiment, several in-line accelerators may be used to implement hot operations of CDFG 150. The cold operations are executed using processor 120.

Referring to FIG. 6, at runtime, the input packets are fed to the in-line accelerator 111 through receive FIFO storage 112 and the generated packets are sent over network 130 by the in-line accelerator 111 through transmit FIFO storage 114. In an embodiment, when an input data enters the in-line accelerator, the in-line accelerator can process the data as long as the execution trace remains in the fast-path. In FIG. 5, the operations that are actually executed in run-time are shown with a bold border. Since the execution trace exits the fast-path in the example illustrated in FIG. 6, bailout from in-line accelerator to processor occurs. More specifically, referring to the example of FIG. 6, the execution trace exits the fast-path after the first state and therefore the in-line accelerator 111 cannot process the input data anymore. The in-line accelerator 111 may terminate the execution for the given input packet and bailout after the execution of the first state.

Upon premature termination of execution by in-line accelerator 111 the execution may be automatically transferred to software running on a processor. The processor may either continue the execution of the program from a state following the bailout point (continuation method) or it may restart the execution from the beginning (rollback method). When rollback method is used, software restarts the execution of the engine from the beginning. When continuation method is used the software continues the execution of the engine from the state following the bailout point. Transfer of execution is discussed in more details below.

FIG. 7 illustrates the schematic diagram of processing of an application engine sliced into hot/cold operations by the data processing system according to an embodiment of the invention. The diagram 700 includes engines A, B, C, D and E interconnected to perform computation on input data elements received from input 701. The computation results are outputted through output 703. The diagram 700 may depict the slicing of a Gorilla kernel into hot states and cold states as explained before. In such an embodiment, each engine may be a GDF node. Each engine may include several execution states, for example, engine D may include states S1-S6. In the example of FIG. 7, states S1, S2, and S5 are hot states and States S3, S4, and S6 are cold states. In an embodiment, each engine may be implemented by an in-line accelerator, a processor, or the combination of the two.

In case of a multi-layer acceleration system, each engine may also be implemented in any of the different acceleration levels depending on the hotness level of its operations. For brevity, the rest of the document discusses the transfer of data and control only between a single in-line accelerator and the processor. However, the same methodology can be used for transferring data and control between multiple accelerator levels between the processor and inline accelerator as well.

The automated transferring of execution from the in-line accelerator to the processor must be such that the flow of execution remains consistent. In an embodiment, transferring of the execution between the in-line accelerator and the processor may occur at the boundary of two engines during an inter-engine transition. The transfer of execution between dataflow nodes may also be referred to as coarse-grain transfer. For example, in FIG. 7, the two engines A and B are in a back-to-back dataflow relationship (e.g., chain relationship). Engine A may be implemented as a hard-wired hardware engine and engine B may be implemented as a software engine. In an embodiment, the transfer of execution may occur upon the completion of execution by hardware engine A. In such a case, after hardware engine A finishes its execution normally, its output data is passed to the next engine, engine B, which is running as software. In such an embodiment, the context memory, which is completely dependent on the input token of hardware engine A, does not have to be transferred. In an embodiment, there may be a shared memory between the two engines A and B. The shared memory may be implemented using a coherency mechanism across the in-line accelerator and the processor.

In an embodiment, transferring of the execution between an in-line accelerator and a processor may be required at any point of processing other than the boundary of two engines. For example, in an embodiment, the transition may occur in the middle of an execution by an engine. The transfer of execution inside a data flow engine node may also be referred to as fine-grain transfer. Under these circumstances, the processor is required to continue the execution in a way that the flow of execution remains consistent. This is especially important and challenging as the realization of each program operation in the accelerator may be in the form of some atomic units including state(s) of a state machine or stage(s) of a pipeline in a hardwired hardware, instruction(s) in SIMD lane(s) in a GPGPU, or micro-code instruction(s) in a network processor. Each of these atomic forms might cover one or more operations associated with the computation of the corresponding kernel. An atomic form might cover only part of an operation and consequently realization of an operation might need multiple units of these atomic units. As a result, when the execution of one of these atomic units terminates on the in-line accelerator side, it is challenging to jump to the right instruction on the processor side that can guarantee a continuous flow of execution. Similar problem may exist when transferring the execution from the processor to the in-line accelerator.

In an embodiment of the invention, the bailing point may be determined using a compilation analysis. The compilation analysis of the engine currently executing the application may suggest how far the execution has been performed.

In an embodiment of the invention, a state machine simulation mechanism is used to achieve precise continuation from an engine, implemented as hardware state machine, to software. The state machine simulation mechanism may provide simulation of hardware state machine on the slow-path state machine on the processor. In an embodiment, the slow-path state machine simulation can be generated from the output of an HLS tool that synthesizes the sliced engine code. In an embodiment, for the accelerated engines, the software will contain the simulated slow-path in addition to the original software engine. Upon occurrence of a bailout, the system may decide to pursue the continuation method by transferring the execution to the corresponding bailout stage in the simulated slow-path state machine. In an embodiment, if the system decides to pursue a rollback method, the execution is transferred to the beginning of the corresponding software engine that is running as natively.

FIG. 8 illustrates the schematic diagram of a state machine simulation mechanism in accordance with an embodiment of the invention. Diagram 810 shows the schematic diagram of fast-path processing of an application sliced into hot/cold operations. Diagram 820 shows the schematic diagram of slow-path state machine simulation of the fast-path according to an embodiment of the invention. Fast-path diagram 810 includes engines A, B, C, D and E interconnected to perform computation on input data elements received from accelerator input 811 and to output the generated output data elements from accelerator output 813. Slow-path diagram 820 is a software simulation of fast-path diagram 810. Upon termination of execution on the fast-path, the bailout point along with the necessary state values is sent to the software engine that simulates the behavior of the state machine.

Referring to fast-path diagram 810, a bailout may occur at first state S1 of engine D. There may be two bailout points (BOP1 and BOP2) associated with different execution routes of the application. As such, the execution terminates in fast-path prematurely. Accordingly, bailout points BOP1 and BOP2 are communicated to the state machine simulator in slow-path 820. In an embodiment, all necessary state values are also communicated to the state machine simulator. Referring now to slow-path diagram 820, the state machine simulator may determine the termination stage of the execution on fast-path 810 and continue the execution on slow-path 820. In an embodiment, the state machine simulator continues the execution of the engine at continuation points CP1 and CP2 corresponding with bailout points BOP1 and BOP2 respectively on simulated engine D. The simulator may complete the execution of the application.

In an embodiment, the state machine simulator only emulates the engine that is currently engaged in the execution. Upon termination of the execution by the current engine, the next engines in the slow-path can be executed natively. For example, after the execution of engine D is completed in the state machine simulator, the result may be passed to a native code (and not the simulated code) of engine E for further computation. In such an embodiment, some performance implications for the slow-path may be avoided. In an embodiment, the slow-path part of the engine may be refactored into multiple engines in order to decrease the overhead of state machine simulation by forcing the execution to switch to native mode earlier.

In an embodiment of the invention, upon premature termination of execution on the in-line accelerator, the processor restarts the execution of the input data as if no processing was done by the in-line accelerator. In an embodiment, in contrast with the continuation method that execution was transferred to the corresponding bailout stage in the simulated slow-path state machine, the execution may be transferred to the beginning of the corresponding software engine that will be running as natively. This method of transferring the execution is referred to as a rollback method. Referring back to FIG. 8, for example, upon termination of the execution by engine D at state S1, the processor may begin the execution at state S1 again, instead of continuing to S2. In such an embodiment, the execution of the trace on the accelerator may be done speculatively. In an embodiment, the side effects of the computation on memories by the in-line accelerator may be rolled back and the processor (or the next level accelerator) may reprocess the data.

Another problem associated with transferring execution between an in-line accelerator and a processor (or the next level accelerator) is transferring the necessary data state between them. The required data that is transferred between the in-line accelerator and the processor (or the next level accelerator) may depend on the type of control transfer method adopted by the system. In an embodiment, the required data to be transferred using a rollback method is different than the required data to be transferred using a continuation method.

FIG. 9A illustrates the schematic diagram of memory block architecture in accordance with an embodiment of the invention. The processing system 900 includes an in-line accelerator 910 and a processor 920. In an embodiment, the processor 920 may be a multi-core processor including core-1, core-2, and core-3. An operating system may divide the processing time of the multi-core processor and assign threads to the resulting timeslots so that the processor runs multiple threads concurrently. A thread is a unit of executing programs. In FIG. 9A, core-1 has been assigned the threads 1-3 for processing. In an embodiment, a multi-core processor system has a distributed system structure such that each central processing unit (CPU) has dedicated memory and accesses shared memory when other data is needed (not shown in the figure). In another embodiment, a multi-core processor system has a centralized shared system structure such that each CPU has only cache memory and stores necessary data in shared memory (not shown in the figure).

Referring to FIG. 9A, processor 920 includes coherent cache 921. Coherent cache 921 may be used to manage conflicts between storage mechanisms of core-1, core-2, and core-3. In an embodiment, coherent cache 921 may also maintain consistency between the processor 920 and main memory. To reduce latency, in alternative embodiments, often one or more levels of high-speed cache memory are used to hold a subset of the data or instructions that are stored in the main memory.

In an embodiment of the invention, in-line accelerator 910 may include multiple engines 1-3. Each engine may execute multiple threads 1-3. Each engine includes in-token memory 911, out-token memory 912, and context memory 913. Incoming data elements are copied into in-token memory 911 and outgoing data elements are copied into out-token memory 912. Context memory 913 stores transient context data (e.g., packet/frame data) that is unique to a specific process, along with pointers that reference data structures and tables stored in. Context memory 913 includes data states private to the computation associated to a given input token. When processing a new token, the previous content of these memories does not affect the output results.

In an embodiment, in-line accelerator 910 further includes accelerator level shared memory 914. Accelerator level shared memory 914 stores data states that are shared between computations of different input data elements for a single kernel or computations of multiple kernels. A kernel may need to be explicitly defined as a client of a shared memory scope or the shared memory may not accessible to the kernel. The shared memory must be coherent with the global shared memory which shared between the process and in-line accelerator (or other layers of acceleration in a multilayer scenario). In-line accelerator 910 also includes coherent memory 915. Coherent cache 915 may manage conflicts between engine storage mechanisms and maintain consistency between in-line accelerator 910 and main memory. To reduce latency, in alternative embodiments, often one or more levels of high-speed cache memory are used to hold a subset of the data or instructions that are stored in the main memory.

In-line accelerator 910 (and other accelerators in different acceleration layers) and processor 920 both are coupled to global shared memory 930. Global shared memory may be in communication with coherent caches 915 and 921. Global states, e.g., shared data structures, may be stored in global shared memory 930 and may be accessed by both in-line accelerator 910 and processor 920 (or other accelerators in a multilayer system). Synchronization mechanisms to ensure mutual exclusion of data may be used as explained before to manage the access of shared data in global shared memory 930.

In transferring execution from the in-line accelerator to the processor, it may be necessary to transfer data between different memory components. Once the in-line accelerator begins execution, engine-1 accesses the input data elements stored in in-token memory 911 for computation. Throughout the execution by in-line accelerator 910, changes may be made to data stored in context memory 913 and shared memories 914 and 930. The output data elements generated by the engine-1 are also stored in out-token memory 912. Therefore, upon termination of the execution by the in-line accelerator 910 the state of the stored data may be altered relative to the start of the execution.

In an embodiment, transferring of data between the in-line accelerator and the processor may occur at the boundary of two engines during an inter-engine transition. This kind of transfer of execution between dataflow engine nodes may also be referred to as coarse-grain transfer. For example, referring back to FIG. 8, the two engines A and B are in a back-to-back dataflow relationship (e.g., chain relationship). Engine A may be implemented as a hard-wired hardware engine and engine B may be implemented as a software engine. In an embodiment, the transfer of execution may occur upon the completion of execution by hardware engine A.

In such an embodiment, the system may perform transfer of data using virtual channels to move the data elements between the in-line accelerator and the processor. Multiple virtual channels can be used on a single physical interface (e.g. a PCIe interface). In an embodiment, the elements stored in the in-token memory 911 and context memory 913 does not need to be transferred. However, the changes to the global shared memory must become visible to the software engine. In coarse-grain transfer, output token may also transferred to the input token of the software engine through virtual channels as discussed before.

In an embodiment, transferring of the execution between an in-line accelerator and a processor may be required at any point of processing other than the boundary of two engines. In an embodiment, the transition may occur in the middle of an execution by an engine. For example, referring back to FIG. 8, engine D may terminate execution at very first state S1. As such, transfer of data between the in-line accelerator and processor may occur inside a dataflow node. Upon termination of execution on engine D, the bailout point along with the necessary state values is sent to a software engine. The software engine may be a state machine simulator that emulates the behavior of the state machine, as explained above with respect to continuation method.

In such an embodiment, the input data elements stored in in-token memory 911 may be needed to complete the execution. Therefore, the input data elements may be copied to an in-token memory of the software engine on processor. Since part of output data might be constructed already, the output data elements stored in out-token memory 912 may be required to be transferred to the subsequent engine. As such, the content of out-token memory 912 may be copied to an out-token memory of the software engine. Similarly, the changes to the context memory 913 may be copied to a dedicated place visible to the software engine in order to continue execution from the bailing point. In an embodiment, the changes to content of global shared memory 930 may already be visible and coherent from the processor side. In such an embodiment, no further action may be required. In an alternative embodiment, at least a portion of the changes made by in-line accelerator 910 to content of the global shared memory 930 may not be visible or coherent form the processor perspective. As such, those changes may be copied to a dedicated place visible to the software engine on the processor 920. In an embodiment, the content of the context memory 913 is made available to the processor 920. In other embodiments, the content of the context memory 913 is only copied to a memory accessible to the software engine if the content is predicted to be used in the future computation of the software engine. In an embodiment, such a predication will be based on a prediction mechanism at the compilation time, using profiling or static data-flow analysis.

In an embodiment of the invention, upon termination of the execution on the in-line accelerator, the processor restarts the execution of the input data as if no processing was done by the in-line accelerator (rollback method). Referring back to FIG. 8, for example, upon termination of the execution by engine D at state S1, the processor may begin the execution at state S1 again, instead of continuing to S2.

In such an embodiment, the input data elements stored in in-token memory 911 may be required to perform the necessary computation. As such, the content of in-token memory 911 must be copied to a memory accessible to the processor. On the other hand, because processor 920 restarts the execution as if no processing was done by in-line accelerator 910, the content of out-token memory 912 and context memory 913 may be ignored. In an embodiment, the changes made to shared memory 930 by in-line accelerator 910 may be rolled back. In an embodiment, if reversing the changes is not possible the system may not be able to perform the rollback method and may perform the continuation method instead.

Table 1 below shows the summary of state transfer for different memory types when transitioning from hardware accelerator to software under different scenarios according to an embodiment of invention.

TABLE 1 Data state transfer for different memory types upon bailout. Fine-grain/ Fine-grain/ Coarse-grain rollback Continuation Control Jump to Jump to the SW Jump to the transfer the next engine associated corresponding SW engine with this operation in the accelerated simulated slow-path engine (with the engine of this HW native execution) engine In-token No action Copy to in-token Copy to in-token memory necessary memory of SW memory of simulated engine HW engine if used later Out-token Copy the output No action If changed, memory token to the input necessary copy to out- of the next SW token memory of engine simulated HW engine if used later Context No action No action If used later, changes memory necessary necessary must be copied to context memory of the simulated HW engine Shared Changes must The changes Changes must become memory become visible to must be visible to SW rolled back the simulated HW engine

The transfer of data state from context and shared memories in continuation method can be complicated and may generate a high overhead. The next section discusses mechanisms to implement these transfers more efficiently.

In an embodiment, during the bailout, the system maps all the shared memories that have a client engine with the possibility of bailout as part of a memory space that is coherent from the processor point of view. Therefore, upon continuation, the latest data states in these memories may become automatically visible by the software engines on the processor. In an alternative embodiment, the system changes the shared memories in a way that they are not coherent from the processor side before the bailout and becomes coherent only after the bailout point. This will reduce the overhead of keeping all shared memories coherent all the time.

In an embodiment, in addition to the shared memories, all the state data may be required to become available to the engine software, e.g. simulator, on the processor side. In an embodiment, all in-token, out-token, and context memories are copied to the processor side. In an embodiment, a bailout table is used to minimize the overhead of the transfer as explained further below.

FIG. 10 illustrates the schematic diagram of implementing a bailout table in accordance with an embodiment of the invention. In an embodiment, transfer of data between in-line accelerator 1010 and processor 1020 is managed by bailout table 1030. Bailout table 1030 keeps track of a set of variables for each bailout case. The set may include only the necessary variables to continue execution. In an embodiment, for each bailout point, the bailout table 1030 may include a set indicating which variables might have been used in a write operation and later be used in a read operation. In an embodiment, the bailout table includes two sections. The first section 1031 keeps track of the memory elements written by previous operations in the engine. The second section 1032 keeps track of the memory elements that later might be read by next operations after bailout. In an embodiment, these memory elements may belong to any of the in-/out-token, context or shared memories explained in previous section.

In an embodiment, bailout table 1030 may be generated in a fully static (compiler based) approach. In an embodiment, bailout table 1030 is populated using a static compiler analysis. In an embodiment, the analysis may be performed while the accelerated engine code is being generated during compilation time. In an embodiment, the compiler may use a conservative data-flow analysis to find the possible write set before the bailout and possible read set after the bailout. The compiler may use classic dataflow dependency analysis to generate the bailout table.

In an embodiment, bailout table 1030 may be generated in a fully dynamic (runtime based) approach. In an embodiment, tracking the variables that have been used in a write operation in the bailout table can be maintained dynamically using an extra bit added to each value (for example, in memories or registers). In compiler-based approach, a more conservative data-flow analysis may be used and the bailout table 1030 may store unnecessary variables (or memory ranges). The dynamic written-bit tracking method may be more costly at runtime. The dynamic method may not determine if the marked variables will be used after continuation.

In an embodiment, the combination of the runtime-based and complier-based approach is used to populate bailout table 1030. In an embodiment, the compiler statically generates the table for candidates using a compile time analysis. At runtime, however, the accelerator may only transfer the variables or rangers in the table that have their written-bit set.

In an embodiment, big data structures such as arrays may be tracked in bailout table 1030 as a set of memory ranges in the table. In other embodiments, the big data structures are tracked in bailout table 1030 by just storing the start of the array and a metadata representing the part(s) of the array that are modified and will be used by the software following continuation. In an embodiment, the metadata may be a data structure similar to interval trees stored as bitmaps out of bailout table. Each node in the tree may represent a range of the corresponding array elements that is modified by the accelerator and used later by the software following continuation. For example, in an embodiment, each node in the tree may be 32 bits and divided to four 8-bit components. The first two 8-bit components may store the range indexes for the array and the next two 8-bit components are pointers to the left and right children nodes of the node (8-bit offsets relative to the beginning of the tree data structure).

According to an embodiment of the invention, the bailout table 1030 is compressed by grouping the variables. In such an embodiment, the group identifiers are stored in the list rather than the variables themselves. In an alternative embodiment, instead of listing individual variables, the table can only include data groups where each group represents an address interval of the memory ranges modified by the hardware in-line accelerator 1010 and may be used later by a software engine in the processor 1020.

In an embodiment, the copied values of the variables with high probability of being used by the remaining code in the slow-path are pushed to the lower level of cache hierarchy. In an embodiment, these variables are copied directly to the processor cache. Therefore, an embodiment of the invention proposes having two sets of shared variables for each bailout point in bailout table 1030. The first may be the set of variables (or memory ranges) that are simply copied to the coherent global shared memory and become visible to the processor immediately. The second set may be the set of variables which are pushed to the next level cache (evicted from accelerator local cache) in addition to get copied. The variables with high read probability on the slow-path may be identified using profiling of the application.

Table 2 is an example of a bailout table according to an embodiment of the invention. The bailout table provides the variables to track two bailout points (State-1 and State-2). The variables are divided in to two sets of “move set” and “move and push set”. The variables under “move set” are the set of variables (or memory ranges) that are simply copied to the global shared memory that is coherent and become visible to the processor. The variables under “move and push set” are the set of variables which are pushed to the next level cache (evicted from in-line accelerator local cache) in addition to get copied. In the example table below, State-1 includes a first set of variables {vid1, vid2} under “move set” category and a second set of variables {id3} under “move and push set” category. State-2, however, only includes one set of variables {(L1, U1), (L2, U2)} under “move set” category. In an embodiment, the bailout point may only include variables under “move and push set” category. These variables or ranges may belong to any one of in-token, out-token, context or shared memories.

TABLE 2 An exemplary bailout table according to an embodiment Bailout point Move set Move and push set State-1 {vid1, vid2} {id3} State-2 {(L1, U1), (L2, U2)}

In many cases, the overhead of computing the move set and performing the move is very high. This is particularly important given the fact that the in-line accelerator needs to be utilized for fast-path operations and having to store and move much information can be prohibitive. In such cases, it might be beneficial to roll back some of the accelerator computation. A pure rollback mechanism, however, may require an unbounded speculative memory to revert the modifications to the shared memories.

In an embodiment of the invention, the continuation and rollback methods are combined to make a more efficient transfer of execution from the in-line accelerator to the processor. In an embodiment, certain pre-determined rollback points are defined in the fast path. The system may keep data written into the shared memory in a speculative state as long as possible. Upon a bailout, a rollback method may be used if the speculative data is not changed to non-speculative.

FIG. 9B illustrates the schematic diagram of memory block architecture including quasi-speculative cache in accordance with an embodiment of the invention. FIG. 9B illustrates another embodiment in which the same reference numerals have been used to denote similar elements, parts and components to those of the embodiment depicted in FIG. 9A. A detailed discussion of similar components and similar functionality will therefore not be repeated for the sake of brevity, and only the differences between the first and second embodiments will be described in detail.

In an embodiment, quasi-speculative memory 916 is used to postpone committing of the speculative data as long as possible. In a rollback method, quasi-speculative memory 916 may be used to rollback changes to the shared memory 930. In a continuation method, quasi-speculative memory 916 may be used to copy the changes on shared memory 930 for continuation purpose. While quasi-speculative memory 916 delays committing of the speculative data, it may not guarantee the rollback on speculative data when it runs out of speculative storage. In an embodiment, for a given input data, a rollback-based bailout can be done as long as all the data associated with the input is still not committed. In an embodiment, if any of the data associated with the input is committed only continuation method is possible.

In an embodiment of the invention, quasi-speculative memory 916, apart from standard load/store commands, includes commands to start, end, and abort a speculative session. Referring to table 3 below, some of the quasi-speculative cache commands are provided. The “begin speculative session” command may start a speculative session and get a thread id as an argument. From this point on, all the load and stores from this thread will be associated with the session. Later, when “end speculative session” is called, the memory may commit the speculative values to non-speculative ones. The “abort speculative session” instruction may abort all the changes associated with this speculative session or if abortion is not possible anymore, the memory may report it. At this stage, the set of variables, which are written by the thread during the speculative session, can be read using “get written-back set”. The write set may be in form of a bit vector in that each bit indicates whether a memory word/block is written by the thread during the speculative session. “Write-back” command may be used when continuation happens and we know that the write-set of a thread will be used soon used by the slow path. In such situation writing back the write-set can improve the performance of the system.

In an embodiment, unlike conventional transactional memories, the abort mechanism is not an internal event. The abortion may occur based on an external request to the cache when bailout happens. An abort mechanism may be the desired bailout scenario. In quasi-speculative cache when there are conflicts between accesses from different threads and there is no more space to save the speculative value, the default behavior may commit the oldest speculative value to non-speculative state. This may make the session associated with the committed speculative value non-speculative. Therefore, the chance of using rollback for that particular speculative session may be eliminated In an embodiment, unlike conventional transactional memory, the speculative memory does not need to support atomicity of transactions. If atomicity is required, it may be provided using synchronization mechanisms, e.g. lock engines explained in previous sections.

TABLE 3 speculative cache commands Command Input Output Begin speculative session Thread id No output End speculative session Thread id No output Get written-back set Thread id, Write set bit vector address range Abort speculative session Thread id Status (successful abort or not) Standard load/store Thread id, Address Read data or no output and/or store data Write-back Thread id No output

In an embodiment of the invention, the system performs a cost analysis to determine whether to use continuation method or rollback method for a given bailout. Depending on the amount of data that needs to be transferred as well as the amount of pre-bailout computation, the cost of rollback or continuation may change. In an embodiment, the compiler may be used to calculate the cost of each method. The compiler may perform a static analysis and profiling phase to suggest rollback or continuation for a given bailout point. The in-line accelerator may later use these suggestions to perform rollback or continuation method. The following formulas can be used to estimate the cost for rollback and continuation:

-   -   Continuation Cost={Alpha×Move set size}         -   Move set size (continuation)={in-token and out-token move             set size+context move set size+shared memory move set size}     -   Rollback Cost={(Alpha×Move set size)+(Beta×Compute         overhead)+(Gamma×rollback size)}         -   Move set size (continuation)=in-token move set size         -   Rollback overhead=shared memory move set size

The Alpha, Beta, and Gamma constants can be tuned for a specific architecture by running and profiling several workloads while measuring the actual latency of move set. Tuning can be done once for a set of applications and later used for any other application. Alpha models the cost of moving data between the in-line accelerator and processor (or, the next layer of in-line accelerator). Therefore, if in a system moving data is more expensive we will have higher Alpha value. Beta models the cost of computation in in-line accelerator. Therefore, in a system with a high performance in-line accelerator Beta is low and in a system with a low performance in-line accelerator Beta is high Gamma models the cost associated with rolling back the speculative data (e.g. in quasi-speculative cache).

FIG. 11 is a flow diagram illustrating a method flowchart for transferring execution according to an embodiment of the disclosure. Although the stages in the flowcharts with reference to FIG. 11 are shown in a particular order, the order of the actions can be modified. Thus, the illustrated embodiments can be performed in a different order, and some actions/blocks may be performed in parallel. Some of the blocks and/or operations listed in FIG. 11 are optional in accordance with certain embodiments. The numbering of the blocks presented is for the sake of clarity and is not intended to prescribe an order of operations in which the various blocks must occur. Additionally, operations from the various flows may be utilized in a variety of combinations.

At stage 1101 of FIG. 11 the execution by the in-line accelerator terminates prematurely. The processing point at which the execution of the application terminates is called the bailout point. To complete the execution of the application, the in-line accelerator may transfer the execution to another in-line accelerator or a processor. The bailout point may occur at the boundary of two engines during an inter-engine transition or during execution by an engine.

At stage 1102 the in-line accelerator determines the appropriate method to implement the bailout. Bailout is the process of transitioning the computation associated with an input from the in-line accelerator to the processor. In an embodiment, the in-line accelerator implements the bailout using a continuation method 1110. The continuation method 1110 is a kind of bailout in which the processor continues the execution of input data on the accelerator from the bailout point. In another embodiment, the in-line accelerator implements the bailout using a rollback method 1120. In the rollback method 1120 the processor restarts the execution of an input data from the beginning. In other embodiments, a combination of the continuation and rollback methods may be adopted by the in-line accelerator.

The determination of whether a continuation method 1110 is used or a rollback method 1120 depends upon multiple factors. In an embodiment, a cost analysis is performed according to this disclosure to determine the more efficient method under the circumstances. In an embodiment, the cost of transferring execution based on each method depends upon the amount data required to be transferred. In an embodiment, the default method of transferring execution is rollback method 1120. The implementation of rollback method 1120 may not be possible, however, where data has been committed to non-speculative storages. In an embodiment, the quasi-speculative cache is used to delay committing data to non-speculative storages.

At stage 1111 of continuation method 1110, the system determines the bailout point at which the execution of the application terminated prematurely. The determination of bailout stage facilitates continuation of execution by the processor. In an embodiment, the execution is prematurely terminated at the boundary of two engines. In an embodiment, as shown in FIGS. 7 and 8, a state machine simulator on slow-path is used to emulate the in-line accelerator behavior. Upon occurrence of a bailout, the state machine simulator continues execution from the bailout point.

At stage 1112 of the continuation method 1110, the in-line accelerator transfers the necessary data to processor to continue execution. In the continuation method 1110, all content of in-token, out-token, and context memory may be required to be available to the processor. In an embodiment, the changes made to the shared memory by the in-line accelerator may be required to become visible to the general purpose process. In an embodiment, a bailout table, as shown in FIG. 10, is used to selectively transfer only the required data states and avoid the overhead of transferring unnecessary additional data.

At stage 1113, the processor continues execution of the application. In an embodiment, the execution is continued on a software engine, for example, a state machine simulator, on the slow-path.

In an embodiment of the invention, at stage 1102 the system may decide to transfer execution using rollback method 1120. In an embodiment, the rollback method 1120 may be the preferred method of bailout. At stage 1121 of the rollback method 1120 the necessary data may be transferred from the in-line accelerator to the processor for execution. In an embodiment, the input data elements stored in in-token memory is transferred. In an embodiment, the out-token memory and context memory may be ignored.

At stage 1122, the changes to the shared memory must be rolled back. In an embodiment, a quasi-speculative cache is used to roll back changes made to the memory. In an embodiment, if the changes made by the in-line accelerator to the shared memory cannot be rolled back, rollback method 1120 may not be possible and continuation method 1110 is pursued.

At stage 1123, the processor restarts the execution of the application as if no processing was done by the in-line accelerator. In an embodiment, at stage 1123 the execution of the CDFG is started by software from the beginning.

At stage 1103, the execution is finished by software engine on the processor. In an embodiment, the application may be transferred to other software engines or may be transferred to a hardware in-line accelerator for further processing. In an embodiment, a response packet is generated at stage 1103.

FIG. 12 is a diagram of a computer system including a data processing system according to an embodiment of the invention. Within the computer system 1200 is a set of instructions for causing the machine to perform any one or more of the methodologies discussed herein. In alternative embodiments, the machine may be connected (e.g., networked) to other machines in a LAN, an intranet, an extranet, or the Internet. The machine can operate in the capacity of a server or a client in a client-server network environment, or as a peer machine in a peer-to-peer (or distributed) network environment, the machine can also operate in the capacity of a web appliance, a server, a network router, switch or bridge, or any machine capable of executing a set of instructions (sequential or otherwise) that specify actions to be taken by that machine. Further, while only a single machine is illustrated, the term “machine” shall also be taken to include any collection of machines (e.g., computers) that individually or jointly execute a set (or multiple sets) of instructions to perform any one or more of the methodologies discussed herein.

Data processing system 1202, as disclosed above, includes a processor 1227 and an in-line accelerator 1226. The processor may be one or more processors or processing devices (e.g., microprocessor, central processing unit, or the like). More particularly, data processing system 1202 may be a complex instruction set computing (CISC) microprocessor, reduced instruction set computing (RISC) microprocessor, very long instruction word (VLIW) microprocessor, processor implementing other instruction sets, or processors implementing a combination of instruction sets. The in-line accelerator may be one or more special-purpose processing devices such as an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), a digital signal processor (DSP), network processor, many light-weight cores (MLWC) or the like. Data processing system 1202 is configured to implement the data processing system for performing the operations and steps discussed herein.

The exemplary computer system 1200 includes a data processing system 1202, a main memory 1204 (e.g., read-only memory (ROM), flash memory, dynamic random access memory (DRAM) such as synchronous DRAM (SDRAM) or DRAM (RDRAM), etc.), a static memory 1206 (e.g., flash memory, static random access memory (SRAM), etc.), and a data storage device 1216 (e.g., a secondary memory unit in the form of a drive unit, which may include fixed or removable computer-readable storage medium), which communicate with each other via a bus 1208. The storage units disclosed in computer system 1200 may be configured to implement the data storing mechanisms for performing the operations and steps discussed herein.

The computer system 1200 may further include a network interface device 1222. In an alternative embodiment, the data processing system disclose is integrated into the network interface device 1222 as disclosed herein. The computer system 1200 also may include a video display unit 1210 (e.g., a liquid crystal display (LCD), LED, or a cathode ray tube (CRT)) connected to the computer system through a graphics port and graphics chipset, an input device 1212 (e.g., a keyboard, a mouse), a camera 1214, and a Graphic User Interface (GUI) device 1220 (e.g., a touch-screen with input & output functionality).

The computer system 1200 may further include a RF transceiver 1224 provides frequency shifting, converting received RF signals to baseband and converting baseband transmit signals to RF. In some descriptions a radio transceiver or RF transceiver may be understood to include other signal processing functionality such as modulation/demodulation, coding/decoding, interleaving/de-interleaving, spreading/dispreading, inverse fast Fourier transforming (IFFT)/fast Fourier transforming (FFT), cyclic prefix appending/removal, and other signal processing functions.

The Data Storage Device 1216 may include a machine-readable storage medium (or more specifically a computer-readable storage medium) on which is stored one or more sets of instructions embodying any one or more of the methodologies or functions described herein. Disclosed data storing mechanism may be implemented, completely or at least partially, within the main memory 1204 and/or within the data processing system 1202 by the computer system 1200, the main memory 1204 and the data processing system 1202 also constituting machine-readable storage media.

The computer-readable storage medium 1224 may also be used to one or more sets of instructions embodying any one or more of the methodologies or functions described herein. While the computer-readable storage medium 1224 is shown in an exemplary embodiment to be a single medium, the term “computer-readable storage medium” should be taken to include a single medium or multiple media (e.g., a centralized or distributed database, and/or associated caches and servers) that stores the one or more sets of instructions. The terms “computer-readable storage medium” shall also be taken to include any medium that is capable of storing or encoding a set of instructions for execution by the machine and that cause the machine to perform any one or more of the methodologies of the present invention. The term “computer-readable storage medium” shall accordingly be taken to include, but not be limited to, solid-state memories, and optical and magnetic media.

The above description of illustrated implementations of the invention, including what is described in the Abstract, is not intended to be exhaustive or to limit the invention to the precise forms disclosed. While specific implementations of, and examples for, the invention are described herein for illustrative purposes, various equivalent modifications are possible within the scope of the invention, as those skilled in the relevant art will recognize.

These modifications may be made to the invention in light of the above detailed description. The terms used in the following claims should not be construed to limit the invention to the specific implementations disclosed in the specification and the claims. Rather, the scope of the invention is to be determined entirely by the following claims, which are to be construed in accordance with established doctrines of claim interpretation.

Embodiments of the invention include a data processing system. The system includes a processing device, an Input/output (I/O) interface to receive incoming data, and an in-line accelerator configured to receive the incoming data from the I/O interface and begin a computation by executing at least a part of operations associated with processing the incoming data. The in-line accelerator is configured to automatically transfer the prematurely terminated computation upon reaching a bailout point from the in-line accelerator to the processing device for execution.

Additional embodiment of invention may include a data processing system wherein the in-line accelerator is configured to accelerate a fast path of execution that is generated by static or dynamic slicing of control and data flow graphs (CDFG) of programs. Additional embodiment of invention may include a data processing system wherein the bailout point and necessary state values are determined at compilation time.

Additional embodiment of invention may include a data processing system wherein the processing device restarts execution of the entire operations associated with processing the incoming data.

Additional embodiment of invention may include a data processing system wherein the processing device continues computation associated with processing the incoming from the bailout point. Additional embodiment of invention may include a data processing system wherein a software-based simulator is used to simulate the in-line accelerator execution from the bailout point. Additional embodiment of invention may include a data processing system wherein upon termination of the execution by the software-based simulator a software-based engine continues the computation natively.

Additional embodiment of invention may include a data processing system wherein the in-line accelerator is implemented on a Field Programmable Gate Array (FPGA).

Embodiments of the invention include a data processing system. The system includes a processing device, at least one in-line accelerator, and a shared memory coupled to the processing device and the at least one in-line accelerator. The at least one in-line accelerator is configured to receive incoming data and execute at least a part of operations associated with processing the incoming data to generate output data elements. The at least one in-line accelerator is configured to store at least part of data state elements with respect to execution of the incoming data in the shared memory. The at least one in-line accelerator is configured to transfer data state elements upon reaching a bailout point from the at least one in-line accelerator to the processing device for execution.

Additional embodiment of invention may include a data processing system wherein the data state elements stored in the shared memory becomes coherent from the processing device side after the bailout point.

Additional embodiment of invention may include a data processing system wherein the in-line accelerator stores data in the shared memory speculatively.

Additional embodiment of invention may include a data processing system further comprising a quasi-speculative cache memory to store the data state elements in a speculative state. In an embodiment, the quasi-speculative cache is configured to delay committing data state elements to non-speculative storages. In an embodiment, the quasi-speculative cache is configured to copy changes to the data state element to the shared memory. In an embodiment, the in-line accelerator is configured to transfer data state elements based on a probability of being read by next operations after the bailout.

Embodiments of the invention include a method of data processing. The method includes receiving incoming data elements by an in-line accelerator for execution, executing at least part of a computation to process incoming data elements before a premature termination, transferring the incoming data elements to a processing device, and processing the incoming data elements by the processing device.

In an additional embodiment the method of data processing includes processing device continues execution of the computation associated with the incoming data elements.

In an additional embodiment the method of data processing includes the processing device restarts the computation associated with processing the incoming data elements.

In an additional embodiment the method of data processing further includes determining whether to continue or restart execution of the computation associated with processing the incoming data elements based on a cost analysis mechanism. 

1. A data processing system comprising: a processor; an Input/output (I/O) interface to receive incoming data; and an in-line accelerator configured to receive the incoming data from the I/O interface and begin a computation by executing at least a part of operations associated with processing the incoming data, the in-line accelerator is configured to automatically transfer the prematurely terminated computation upon reaching a bailout point from the in-line accelerator to the processor for execution.
 2. The system of claim 1, wherein the in-line accelerator is configured to accelerate a fast path of execution that is generated by static or dynamic slicing of control and data flow graphs (CDFG) of programs.
 3. The system of claim 2, wherein the bailout point and necessary state values are determined at compilation time.
 4. The system of claim 1, wherein the processor restarts execution of the entire operations associated with processing the incoming data.
 5. The system of claim 1, wherein the processor continues computation associated with processing the incoming from the bailout point.
 6. The system of claim 5, wherein a software-based simulator is used to simulate the in-line accelerator execution from the bailout point.
 7. The system of claim 6, wherein upon termination of the execution by the software-based simulator a software-based engine continues the computation natively.
 8. The system of claim 1, wherein the in-line accelerator is implemented on a Field Programmable Gate Array (FPGA).
 9. A data processing system comprising: a processor; at least one in-line accelerator; and a shared memory coupled to the processor and the at least one in-line accelerator, the at least one in-line accelerator is configured to receive incoming data and execute at least a part of operations associated with processing the incoming data to generate output data elements, the at least one in-line accelerator is configured to store at least part of data state elements with respect to execution of the incoming data in the shared memory, the at least one in-line accelerator is configured to transfer data state elements upon reaching a bailout point from the at least one in-line accelerator to the processor for execution.
 10. The system of claim 8, wherein the data state elements stored in the shared memory becomes coherent from the processor side after the bailout point.
 11. The system of claim 10, wherein the at least one in-line accelerator stores data in the shared memory speculatively.
 12. The system of claim 10 further comprising a quasi-speculative cache memory to store the data state elements in a speculative state.
 13. The system of claim 13, wherein the quasi-speculative cache is configured to delay committing data state elements to non-speculative storages.
 14. The system of claim 13, wherein the quasi-speculative cache is configured to copy changes to the data state element to the shared memory.
 15. The system of claim 10, wherein the at least one in-line accelerator is configured to transfer data state elements that are written by previous operations.
 16. The system of claim 14, wherein the at least one in-line accelerator is configured to transfer data state elements based on a probability of being read by next operations after the bailout.
 17. A data processing method comprising: receiving incoming data elements by an in-line accelerator for execution; executing at least part of a computation to process incoming data elements before a premature termination; transferring the incoming data elements to a processor; and processing the incoming data elements by the processor.
 18. The method of claim 18, wherein the processor continues execution of the computation associated with the incoming data elements.
 19. The method of claim 18, wherein the processor restarts the computation associated with processing the incoming data elements.
 20. The method of claim 17 further comprises determining whether to continue or restart execution of the computation associated with processing the incoming data elements based on a cost analysis mechanism. 